package huixue.cn.com.rxapp.config;

import android.provider.Settings;

import com.facebook.drawee.backends.pipeline.Fresco;

import huixue.cn.com.library.util.PackageUtils;
import huixue.cn.com.library.util.ToastUtils;
import huixue.cn.com.rxapp.api.RetrofitService;
import huixue.cn.com.rxapp.app.RxAppApplication;
import huixue.cn.com.rxapp.entity.DeviceInfo;


/**
 * Created by gongdongyang on 2018/7/17.
 */

public class SystemConfig {

    private static  SystemConfig systemConfig;

    private SystemConfig (){

    }

    public static SystemConfig getSystemConfig() {
        if(systemConfig == null){
            synchronized (SystemConfig.class){
                if(systemConfig==null){
                    systemConfig = new SystemConfig();
                }
            }
        }
        return systemConfig;
    }

    public void initConfig(){
        RetrofitService.init();
        ToastUtils.init(RxAppApplication.getApplictionContext());
        Fresco.initialize(RxAppApplication.getApplictionContext());
        initPhone();


    }

    private void initPhone() {
        DeviceInfo.mDeviceID = Settings.System.getString(
                RxAppApplication.getApplictionContext().getContentResolver(),
                Settings.Secure.ANDROID_ID);

        DeviceInfo.mVersionID = PackageUtils.getVersionName(RxAppApplication.getApplictionContext());
        DeviceInfo.mPhoneType = "Android";
        //DeviceInfo.mChannel = ChannelUtil.getChannel(RxAppApplication.getApplictionContext());
        DeviceInfo.mSource = "1";
    }


}
